package cn.stylefeng.guns.modular.business.controller;

import cn.stylefeng.guns.modular.business.pojo.WxInstallRequest;
import cn.stylefeng.guns.modular.business.service.WxInstallService;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 价格管理控制器
 *
 * @author 施律名
 * @date 2022-03-18 20:36:37
 */
@RestController
@ApiResource(name = "价格管理")
public class WxInstallController {

    @Resource
    private WxInstallService wxInstallService;

    /**
     * 添加价格
     *
     * @author 施律名
     * @date 2022-03-18 20:36:37
     */
    @PostResource(name = "添加价格", path = "/wx/install/add")
    public ResponseData add(@RequestBody @Validated(WxInstallRequest.add.class) WxInstallRequest wxInstallRequest) {
        wxInstallService.add(wxInstallRequest);
        return new SuccessResponseData();
    }

    /**
     * 删除价格
     *
     * @author 施律名
     * @date 2022-03-18 20:36:37
     */
    @PostResource(name = "删除价格", path = "/wx/install/delete")
    public ResponseData delete(@RequestBody @Validated(WxInstallRequest.delete.class) WxInstallRequest wxInstallRequest) {
        wxInstallService.del(wxInstallRequest);
        return new SuccessResponseData();
    }

    /**
     * 编辑价格
     *
     * @author 施律名
     * @date 2022-03-18 20:36:37
     */
    @PostResource(name = "编辑价格", path = "/wx/install/edit")
    public ResponseData edit(@RequestBody @Validated(WxInstallRequest.edit.class) WxInstallRequest wxInstallRequest) {
        wxInstallService.edit(wxInstallRequest);
        return new SuccessResponseData();
    }

    /**
     * 查看价格详情
     *
     * @author 施律名
     * @date 2022-03-18 20:36:37
     */
    @GetResource(name = "查看价格详情", path = "/wx/install/detail")
    public ResponseData detail(@Validated(WxInstallRequest.detail.class) WxInstallRequest wxInstallRequest) {
        return new SuccessResponseData(wxInstallService.detail(wxInstallRequest));
    }

    /**
     * 查询价格列表
     *
     * @author 施律名
     * @date 2022-03-18 20:36:37
     */
    @GetResource(name = "获取价格列表", path = "/wx/install/findList")
    public ResponseData list(WxInstallRequest wxInstallRequest) {
        return new SuccessResponseData(wxInstallService.findList(wxInstallRequest));
    }

    /**
     * 分页查询价格列表
     *
     * @author 施律名
     * @date 2022-03-18 20:36:37
     */
    @GetResource(name = "分页查询", path = "/wx/install/findPage")
    public ResponseData page(WxInstallRequest wxInstallRequest) {
        return new SuccessResponseData(wxInstallService.findPage(wxInstallRequest));
    }

}